package com.guigu.chenjiajun.controller;

import com.guigu.chenjiajun.service.NewProductionPlanRegistrationService;

import com.guigu.common.pojo.DFile;
import com.guigu.common.pojo.MApply;
import com.guigu.common.pojo.SysUsers;
import com.guigu.common.vo.SearchVo;
import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * 新发生生产计划登记
 */

@Controller
@RequestMapping("/plan")
public class NewProductionPlanRegistrationController {

    @Resource
    private NewProductionPlanRegistrationService impl;

    @RequestMapping("/queryPlanDFile")
    @ResponseBody
    public SearchVo<DFile> queryPlanDFile(@RequestBody SearchVo searchVo){
        return this.impl.queryPlanDFile(searchVo);
    }

    @RequestMapping("/productionDfile")
    @ResponseBody
    public DFile productionDfile(String id){
        return  this.impl.queryById(id);
    }


    @RequestMapping("/addApply")
    @ResponseBody
    public int addApply(@RequestBody  List<MApply> mapplies){
        return this.impl.addApply(mapplies);
    }
    @RequestMapping("/queryRegistrant")
    @ResponseBody
    public SysUsers queryRegistrant(){
        return  (SysUsers) SecurityUtils.getSubject().getSession().getAttribute("user");
    }
}
